# cmake_minimum_required(VERSION 3.15)

# # set the project name
# project(Tutorial)

# # find_package(WinSock2 REQUIRED)
# # add the executable
# # find_package(Threads REQUIRED)
# file(GLOB ALL_SOURCE "./include/*.cpp")
# # find_package(Boost 1.84.0 COMPONENTS system thread REQUIRED)
# # message(${Boost_LIBRARIES})

# file(GLOB ALL_HEADER "./header/*.hpp" "./header/*.h")

# include_directories("./header")
# # 注意此时build不要放在该目录下
# add_executable(server  ${ALL_SOURCE} ${ALL_HEADER} main_server.cpp)
# add_executable(client main_client.cpp)

# target_link_libraries(Tutorial INTERFACE ws2_32)
# target_link_libraries(Tutorial INTERFACE ${Boost_LIBRARIES})
# target_include_directories(Tutorial INTERFACE ${Boost_INCLUDE_DIR})

cmake_minimum_required(VERSION 2.6)
project(chat_room)

add_definitions(-std=c++14)


find_package(Boost REQUIRED COMPONENTS 
    system
    filesystem
    )

include_directories(${Boost_INCLUDE_DIRS})

file(GLOB APP_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp )
message(${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB ALL_HEADER "./header/*.hpp" "./header/*.h")
file(GLOB ALL_INCLUDE "./include/*.cpp")
include_directories("./header")
include_directories("./include")
foreach( sourcefile ${APP_SOURCES} )
    file(RELATIVE_PATH filename ${CMAKE_CURRENT_SOURCE_DIR} ${sourcefile})
    string(REPLACE ".cpp" "" file ${filename})
    add_executable(${file} ${ALL_INCLUDE} ${ALL_HEADER} ${sourcefile} )
    target_link_libraries(${file} ${Boost_LIBRARIES})
    target_link_libraries(${file} pthread)
endforeach( sourcefile ${APP_SOURCES} )